import hashlib
import base64

class encry():
    def __init__(self):
        pass
    
    def str_md5(self,strs) -> str:
        strs = strs.encode('utf-8')
        m = hashlib.md5()
        m.update(strs)
        ret = m.hexdigest()
        return ret

    def str_en_b64(self,strs ) -> str:
        byte_strs = strs.encode('utf-8')
        b_strs = base64.b64encode(byte_strs).decode('utf-8')
        return b_strs

    def str_de_b64(self,strs ) -> str:
        byte_strs = strs.encode('utf-8')
        # print(byte_strs)
        d_strs = base64.b64decode(byte_strs).decode('utf-8')
        return d_strs

# if __name__ == '__main__':
#     ss = encry()
#     print(ss.str_de_b64('YXNhZA=='))